package cn.jlearn.proxy.agent.handler.bs;

import cn.jlearn.proxy.common.body.ClientConnectSuccessBody;
import cn.jlearn.proxy.common.handler.AbstractBsHandler;
import cn.jlearn.proxy.common.packet.BsPacket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.core.ChannelContext;

/**
 * @author qianyingchao
 * @version 1.0
 * @date 2021/5/19 10:25 上午
 */
public class ClientConnectSuccessResHandler extends AbstractBsHandler<ClientConnectSuccessBody> {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public Class<ClientConnectSuccessBody> bodyClass() {
        return ClientConnectSuccessBody.class;
    }

    @Override
    public void handler(BsPacket packet, ClientConnectSuccessBody bsBody, ChannelContext channelContext) throws Exception {
        logger.info("连接成功~~");
        logger.info("当前通道协议:{}", bsBody.getProtocol());
        logger.info("访问域名地址:{}", bsBody.getHost());
    }

}
